/**
 * @description: Description
 * @author: lizlong<94648929@qq.com>
 * @since: 2020-09-04 08:51:43
 * @LastAuthor: lizlong
 * @lastTime: 2020-09-04 08:52:02
 */
/* Tiny Advanced Tables plugin
 *
 * Copyright 2010-2019 Tiny Technologies LLC. All rights reserved.
 *
 * Version: 1.0.0-8
 */

!(function (a) {
  "use strict";
  function C() {}
  function m(n) {
    return function () {
      return n;
    };
  }
  function t(n) {
    return n;
  }
  function i(r) {
    for (var o = [], n = 1; n < arguments.length; n++) o[n - 1] = arguments[n];
    return function () {
      for (var n = [], e = 0; e < arguments.length; e++) n[e] = arguments[e];
      var t = o.concat(n);
      return r.apply(null, t);
    };
  }
  function n() {
    return u;
  }
  var e,
    s = m(!1),
    O = m(!0),
    u =
      ((e = {
        fold: function (n, e) {
          return n();
        },
        is: s,
        isSome: s,
        isNone: O,
        getOr: c,
        getOrThunk: o,
        getOrDie: function (n) {
          throw new Error(n || "error: getOrDie called on none.");
        },
        getOrNull: m(null),
        getOrUndefined: m(void 0),
        or: c,
        orThunk: o,
        map: n,
        each: C,
        bind: n,
        exists: s,
        forall: O,
        filter: n,
        equals: r,
        equals_: r,
        toArray: function () {
          return [];
        },
        toString: m("none()"),
      }),
      Object.freeze && Object.freeze(e),
      e);
  function r(n) {
    return n.isNone();
  }
  function o(n) {
    return n();
  }
  function c(n) {
    return n;
  }
  function f(e) {
    return function (n) {
      return (
        (function (n) {
          if (null === n) return "null";
          var e = typeof n;
          return "object" == e &&
            (Array.prototype.isPrototypeOf(n) ||
              (n.constructor && "Array" === n.constructor.name))
            ? "array"
            : "object" == e &&
              (String.prototype.isPrototypeOf(n) ||
                (n.constructor && "String" === n.constructor.name))
            ? "string"
            : e;
        })(n) === e
      );
    };
  }
  function l(n, e) {
    return (
      -1 <
      (function (n, e) {
        return qn.call(n, e);
      })(n, e)
    );
  }
  function N(n, e) {
    for (var t = 0, r = n.length; t < r; t++) {
      if (e(n[t], t)) return !0;
    }
    return !1;
  }
  function d(n, e) {
    for (var t = [], r = 0; r < n; r++) t.push(e(r));
    return t;
  }
  function E(n, e) {
    for (var t = n.length, r = new Array(t), o = 0; o < t; o++) {
      var u = n[o];
      r[o] = e(u, o);
    }
    return r;
  }
  function A(n, e) {
    for (var t = 0, r = n.length; t < r; t++) {
      e(n[t], t);
    }
  }
  function v(n, e) {
    for (var t = [], r = 0, o = n.length; r < o; r++) {
      var u = n[r];
      e(u, r) && t.push(u);
    }
    return t;
  }
  function R(n, e) {
    if (0 === n.length) return [];
    for (var t = e(n[0]), r = [], o = [], u = 0, i = n.length; u < i; u++) {
      var c = n[u],
        a = e(c);
      a !== t && (r.push(o), (o = [])), (t = a), o.push(c);
    }
    return 0 !== o.length && r.push(o), r;
  }
  function h(n, e, t) {
    return (
      (function (n, e) {
        for (var t = n.length - 1; 0 <= t; t--) {
          e(n[t], t);
        }
      })(n, function (n) {
        t = e(t, n);
      }),
      t
    );
  }
  function D(n, e, t) {
    return (
      A(n, function (n) {
        t = e(t, n);
      }),
      t
    );
  }
  function p(n, e) {
    for (var t = 0, r = n.length; t < r; t++) {
      var o = n[t];
      if (e(o, t)) return kn.some(o);
    }
    return kn.none();
  }
  function g(n, e) {
    for (var t = 0, r = n.length; t < r; t++) {
      if (e(n[t], t)) return kn.some(t);
    }
    return kn.none();
  }
  function w(n) {
    for (var e = [], t = 0, r = n.length; t < r; ++t) {
      if (!jn(n[t]))
        throw new Error(
          "Arr.flatten item " + t + " was not an array, input: " + n
        );
      Ln.apply(e, n[t]);
    }
    return e;
  }
  function k(n, e) {
    var t = E(n, e);
    return w(t);
  }
  function b(n, e) {
    for (var t = 0, r = n.length; t < r; ++t) {
      if (!0 !== e(n[t], t)) return !1;
    }
    return !0;
  }
  function I(n, e) {
    var t = Bn.call(n, 0);
    return t.sort(e), t;
  }
  function y(n) {
    return parseInt(n, 10);
  }
  function S(n, e, t) {
    return { major: n, minor: e, patch: t };
  }
  function T(n) {
    var e = /([0-9]+)\.([0-9]+)\.([0-9]+)(?:(-.+)?)/.exec(n);
    return e ? S(y(e[1]), y(e[2]), y(e[3])) : S(0, 0, 0);
  }
  function x(n, e) {
    var t = n - e;
    return 0 == t ? 0 : 0 < t ? 1 : -1;
  }
  function j(n, e) {
    return (
      !!n &&
      -1 ===
        (function (n, e) {
          var t = x(n.major, e.major);
          if (0 !== t) return t;
          var r = x(n.minor, e.minor);
          if (0 !== r) return r;
          var o = x(n.patch, e.patch);
          return 0 !== o ? o : 0;
        })(
          (function (n) {
            return T(
              (function (n) {
                return [n.majorVersion, n.minorVersion]
                  .join(".")
                  .split(".")
                  .slice(0, 3)
                  .join(".");
              })(n)
            );
          })(n),
          T(e)
        )
    );
  }
  function M() {
    for (var e = [], n = 0; n < arguments.length; n++) e[n] = arguments[n];
    return function () {
      for (var t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
      if (e.length !== t.length)
        throw new Error(
          'Wrong number of arguments to struct. Expected "[' +
            e.length +
            ']", got ' +
            t.length +
            " arguments"
        );
      var r = {};
      return (
        A(e, function (n, e) {
          r[n] = m(t[e]);
        }),
        r
      );
    };
  }
  function _(n, e) {
    for (var t = zn(n), r = 0, o = t.length; r < o; r++) {
      var u = t[r];
      e(n[u], u);
    }
  }
  function P(n) {
    return n.slice(0).sort();
  }
  function B(n, e) {
    throw new Error(
      "All required keys (" +
        P(n).join(", ") +
        ") were not specified. Specified keys were: " +
        P(e).join(", ") +
        "."
    );
  }
  function q(n) {
    throw new Error("Unsupported keys for object: " + P(n).join(", "));
  }
  function L(e, n) {
    if (!jn(n))
      throw new Error("The " + e + " fields must be an array. Was: " + n + ".");
    A(n, function (n) {
      if (!In(n))
        throw new Error(
          "The value " + n + " in the " + e + " fields was not a string."
        );
    });
  }
  function z(n) {
    var t = P(n);
    p(t, function (n, e) {
      return e < t.length - 1 && n === t[e + 1];
    }).each(function (n) {
      throw new Error(
        "The field: " +
          n +
          " occurs more than once in the combined fields: [" +
          t.join(", ") +
          "]."
      );
    });
  }
  function V(e, n) {
    var t = v(n, function (n) {
      return !l(e, n);
    });
    0 < t.length && q(t);
  }
  function F(n) {
    return n.dom().nodeName.toLowerCase();
  }
  function W(n) {
    return n.dom().nodeType;
  }
  function U(e) {
    return function (n) {
      return W(n) === e;
    };
  }
  function G(n) {
    return W(n) === Wn || "#comment" === F(n);
  }
  function Y(n, e, t) {
    if (!(In(t) || Mn(t) || Pn(t)))
      throw (
        (a.console.error(
          "Invalid call to Attr.set. Key ",
          e,
          ":: Value ",
          t,
          ":: Element ",
          n
        ),
        new Error("Attribute value was not simple"))
      );
    n.setAttribute(e, t + "");
  }
  function H(n, e, t) {
    Y(n.dom(), e, t);
  }
  function X(n, e) {
    var t = n.dom();
    _(e, function (n, e) {
      Y(t, e, n);
    });
  }
  function $(n, e) {
    var t = n.dom().getAttribute(e);
    return null === t ? void 0 : t;
  }
  function K(n, e) {
    var t = n.dom();
    return !(!t || !t.hasAttribute) && t.hasAttribute(e);
  }
  function J(n, e) {
    n.dom().removeAttribute(e);
  }
  function Q(n) {
    return D(
      n.dom().attributes,
      function (n, e) {
        return (n[e.name] = e.value), n;
      },
      {}
    );
  }
  function Z(n, e) {
    return -1 !== n.indexOf(e);
  }
  function nn(n) {
    return void 0 !== n.style && _n(n.style.getPropertyValue);
  }
  function en(n) {
    var e = Xn(n) ? n.dom().parentNode : n.dom();
    return null != e && e.ownerDocument.body.contains(e);
  }
  function tn(n, e, t) {
    if (!In(t))
      throw (
        (a.console.error(
          "Invalid call to CSS.set. Property ",
          e,
          ":: Value ",
          t,
          ":: Element ",
          n
        ),
        new Error("CSS value must be a string: " + t))
      );
    nn(n) && n.style.setProperty(e, t);
  }
  function rn(n, e, t) {
    var r = n.dom();
    tn(r, e, t);
  }
  function on(n, e) {
    var t = n.dom();
    _(e, function (n, e) {
      tn(t, e, n);
    });
  }
  function un(n, e) {
    var t = n.dom(),
      r = a.window.getComputedStyle(t).getPropertyValue(e),
      o = "" !== r || en(n) ? r : Jn(t, e);
    return null === o ? void 0 : o;
  }
  function cn(n, e) {
    var t = n.dom(),
      r = Jn(t, e);
    return kn.from(r).filter(function (n) {
      return 0 < n.length;
    });
  }
  function an(n, e) {
    !(function (n, e) {
      nn(n) && n.style.removeProperty(e);
    })(n.dom(), e),
      K(n, "style") &&
        "" ===
          (function (n) {
            return n.replace(/^\s+|\s+$/g, "");
          })($(n, "style")) &&
        J(n, "style");
  }
  function fn(n) {
    var e = K(n, "colspan") ? parseInt($(n, "colspan"), 10) : 1,
      t = K(n, "rowspan") ? parseInt($(n, "rowspan"), 10) : 1;
    return { element: m(n), colspan: m(e), rowspan: m(t) };
  }
  function sn(n, e) {
    return n.cells()[e];
  }
  function ln(n, e, t) {
    return 0 != (n.compareDocumentPosition(e) & t);
  }
  function mn(n, e) {
    var t = (function (n, e) {
      for (var t = 0; t < n.length; t++) {
        var r = n[t];
        if (r.test(e)) return r;
      }
    })(n, e);
    if (!t) return { major: 0, minor: 0 };
    function r(n) {
      return Number(e.replace(t, "$" + n));
    }
    return ve(r(1), r(2));
  }
  function dn(n, e) {
    return function () {
      return e === n;
    };
  }
  function vn(n, e) {
    return function () {
      return e === n;
    };
  }
  function hn(n, e) {
    var t = String(e).toLowerCase();
    return p(n, function (n) {
      return n.search(t);
    });
  }
  function pn(e) {
    return function (n) {
      return Z(n, e);
    };
  }
  function gn(n, e) {
    var t = n.dom();
    if (t.nodeType !== Ie) return !1;
    var r = t;
    if (void 0 !== r.matches) return r.matches(e);
    if (void 0 !== r.msMatchesSelector) return r.msMatchesSelector(e);
    if (void 0 !== r.webkitMatchesSelector) return r.webkitMatchesSelector(e);
    if (void 0 !== r.mozMatchesSelector) return r.mozMatchesSelector(e);
    throw new Error("Browser lacks native selectors");
  }
  function wn(n) {
    return (
      (n.nodeType !== Ie && n.nodeType !== je) || 0 === n.childElementCount
    );
  }
  function bn(n, e) {
    return n.dom() === e.dom();
  }
  function yn(n) {
    return Kn.fromDom(n.dom().ownerDocument);
  }
  function Sn(n) {
    return kn.from(n.dom().parentNode).map(Kn.fromDom);
  }
  function Tn(n, e) {
    for (
      var t = _n(e) ? e : s, r = n.dom(), o = [];
      null !== r.parentNode && void 0 !== r.parentNode;

    ) {
      var u = r.parentNode,
        i = Kn.fromDom(u);
      if ((o.push(i), !0 === t(i))) break;
      r = u;
    }
    return o;
  }
  function xn(n) {
    return kn.from(n.dom().previousSibling).map(Kn.fromDom);
  }
  function Cn(n) {
    return kn.from(n.dom().nextSibling).map(Kn.fromDom);
  }
  function On(n) {
    return E(n.dom().childNodes, Kn.fromDom);
  }
  function Nn(n) {
    return (function (n, e) {
      var t = n.dom().childNodes;
      return kn.from(t[e]).map(Kn.fromDom);
    })(n, 0);
  }
  function En(n, e, t) {
    return (function (n, e, t) {
      return v(Tn(n, t), e);
    })(
      n,
      function (n) {
        return gn(n, e);
      },
      t
    );
  }
  function An(n, e) {
    return (function (n, e) {
      return v(On(n), e);
    })(n, function (n) {
      return gn(n, e);
    });
  }
  function Rn(n, e) {
    return (function (n, e) {
      var t = void 0 === e ? a.document : e.dom();
      return wn(t) ? [] : E(t.querySelectorAll(n), Kn.fromDom);
    })(e, n);
  }
  var Dn = function (t) {
      function n() {
        return o;
      }
      function e(n) {
        return n(t);
      }
      var r = m(t),
        o = {
          fold: function (n, e) {
            return e(t);
          },
          is: function (n) {
            return t === n;
          },
          isSome: O,
          isNone: s,
          getOr: r,
          getOrThunk: r,
          getOrDie: r,
          getOrNull: r,
          getOrUndefined: r,
          or: n,
          orThunk: n,
          map: function (n) {
            return Dn(n(t));
          },
          each: function (n) {
            n(t);
          },
          bind: e,
          exists: e,
          forall: e,
          filter: function (n) {
            return n(t) ? o : u;
          },
          toArray: function () {
            return [t];
          },
          toString: function () {
            return "some(" + t + ")";
          },
          equals: function (n) {
            return n.is(t);
          },
          equals_: function (n, e) {
            return n.fold(s, function (n) {
              return e(t, n);
            });
          },
        };
      return o;
    },
    kn = {
      some: Dn,
      none: n,
      from: function (n) {
        return null == n ? u : Dn(n);
      },
    },
    In = f("string"),
    jn = f("array"),
    Mn = f("boolean"),
    _n = f("function"),
    Pn = f("number"),
    Bn = Array.prototype.slice,
    qn = Array.prototype.indexOf,
    Ln = Array.prototype.push,
    zn = (_n(Array.from) && Array.from, Object.keys),
    Vn = function (n) {
      function e() {
        return t;
      }
      var t = n;
      return {
        get: e,
        set: function (n) {
          t = n;
        },
        clone: function () {
          return Vn(e());
        },
      };
    },
    Fn = function (r, o, u) {
      if (0 === o.length)
        throw new Error("You must specify at least one required field.");
      return (
        L("required", o),
        z(o),
        function (e) {
          var t = zn(e);
          b(o, function (n) {
            return l(t, n);
          }) || B(o, t),
            r(o, t);
          var n = v(o, function (n) {
            return !u.validate(e[n], n);
          });
          return (
            0 < n.length &&
              (function (n, e) {
                throw new Error(
                  "All values need to be of type: " +
                    e +
                    ". Keys (" +
                    P(n).join(", ") +
                    ") were not."
                );
              })(n, u.label),
            e
          );
        }
      );
    },
    Wn =
      (a.Node.ATTRIBUTE_NODE, a.Node.CDATA_SECTION_NODE, a.Node.COMMENT_NODE),
    Un = a.Node.DOCUMENT_NODE,
    Gn =
      (a.Node.DOCUMENT_TYPE_NODE,
      a.Node.DOCUMENT_FRAGMENT_NODE,
      a.Node.ELEMENT_NODE),
    Yn = a.Node.TEXT_NODE,
    Hn =
      (a.Node.PROCESSING_INSTRUCTION_NODE,
      a.Node.ENTITY_REFERENCE_NODE,
      a.Node.ENTITY_NODE,
      a.Node.NOTATION_NODE,
      void 0 !== a.window ? a.window : Function("return this;")(),
      U(Gn)),
    Xn = U(Yn),
    $n = function (n) {
      if (null == n) throw new Error("Node cannot be null or undefined");
      return { dom: m(n) };
    },
    Kn = {
      fromHtml: function (n, e) {
        var t = (e || a.document).createElement("div");
        if (((t.innerHTML = n), !t.hasChildNodes() || 1 < t.childNodes.length))
          throw (
            (a.console.error("HTML does not have a single root node", n),
            new Error("HTML must have a single root node"))
          );
        return $n(t.childNodes[0]);
      },
      fromTag: function (n, e) {
        var t = (e || a.document).createElement(n);
        return $n(t);
      },
      fromText: function (n, e) {
        var t = (e || a.document).createTextNode(n);
        return $n(t);
      },
      fromDom: $n,
      fromPoint: function (n, e, t) {
        var r = n.dom();
        return kn.from(r.elementFromPoint(e, t)).map($n);
      },
    },
    Jn = function (n, e) {
      return nn(n) ? n.style.getPropertyValue(e) : "";
    },
    Qn = Fn(V, ["cell", "row", "replace", "gap"], {
      validate: _n,
      label: "function",
    }),
    Zn = function (e, t) {
      void 0 === t && (t = fn), Qn(e);
      function r(n) {
        return (function (n) {
          return e.cell(n);
        })(t(n));
      }
      function o(n) {
        var e = r(n);
        return (
          u.get().isNone() && u.set(kn.some(e)),
          (i = kn.some({ item: n, replacement: e })),
          e
        );
      }
      var u = Vn(kn.none()),
        i = kn.none();
      return {
        getOrInit: function (e, t) {
          return i.fold(
            function () {
              return o(e);
            },
            function (n) {
              return t(e, n.item) ? n.replacement : o(e);
            }
          );
        },
        cursor: u.get,
      };
    },
    ne = (M("width", "height"), M("width", "height"), M("rows", "columns")),
    ee = (M("row", "column"), M("x", "y"), M("element", "rowspan", "colspan")),
    te = M("element", "rowspan", "colspan", "isNew"),
    re = M("element", "rowspan", "colspan", "row", "column"),
    oe = M("element", "cells", "section"),
    ue = M("element", "isNew"),
    ie = M("element", "cells", "section", "isNew"),
    ce = M("cells", "section"),
    ae = M("details", "section"),
    fe = M("startRow", "startCol", "finishRow", "finishCol"),
    se = sn,
    le = function () {
      return (le =
        Object.assign ||
        function (n) {
          for (var e, t = 1, r = arguments.length; t < r; t++)
            for (var o in (e = arguments[t]))
              Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]);
          return n;
        }).apply(this, arguments);
    },
    me = function (n, e) {
      return ln(n, e, a.Node.DOCUMENT_POSITION_CONTAINED_BY);
    },
    de = function () {
      return ve(0, 0);
    },
    ve = function (n, e) {
      return { major: n, minor: e };
    },
    he = {
      nu: ve,
      detect: function (n, e) {
        var t = String(e).toLowerCase();
        return 0 === n.length ? de() : mn(n, t);
      },
      unknown: de,
    },
    pe = "Firefox",
    ge = function (n) {
      var e = n.current;
      return {
        current: e,
        version: n.version,
        isEdge: dn("Edge", e),
        isChrome: dn("Chrome", e),
        isIE: dn("IE", e),
        isOpera: dn("Opera", e),
        isFirefox: dn(pe, e),
        isSafari: dn("Safari", e),
      };
    },
    we = {
      unknown: function () {
        return ge({ current: void 0, version: he.unknown() });
      },
      nu: ge,
      edge: m("Edge"),
      chrome: m("Chrome"),
      ie: m("IE"),
      opera: m("Opera"),
      firefox: m(pe),
      safari: m("Safari"),
    },
    be = "Windows",
    ye = "Android",
    Se = "Solaris",
    Te = "FreeBSD",
    xe = function (n) {
      var e = n.current;
      return {
        current: e,
        version: n.version,
        isWindows: vn(be, e),
        isiOS: vn("iOS", e),
        isAndroid: vn(ye, e),
        isOSX: vn("OSX", e),
        isLinux: vn("Linux", e),
        isSolaris: vn(Se, e),
        isFreeBSD: vn(Te, e),
      };
    },
    Ce = {
      unknown: function () {
        return xe({ current: void 0, version: he.unknown() });
      },
      nu: xe,
      windows: m(be),
      ios: m("iOS"),
      android: m(ye),
      linux: m("Linux"),
      osx: m("OSX"),
      solaris: m(Se),
      freebsd: m(Te),
    },
    Oe = function (n, t) {
      return hn(n, t).map(function (n) {
        var e = he.detect(n.versionRegexes, t);
        return { current: n.name, version: e };
      });
    },
    Ne = function (n, t) {
      return hn(n, t).map(function (n) {
        var e = he.detect(n.versionRegexes, t);
        return { current: n.name, version: e };
      });
    },
    Ee = /.*?version\/ ?([0-9]+)\.([0-9]+).*/,
    Ae = [
      {
        name: "Edge",
        versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
        search: function (n) {
          return (
            Z(n, "edge/") &&
            Z(n, "chrome") &&
            Z(n, "safari") &&
            Z(n, "applewebkit")
          );
        },
      },
      {
        name: "Chrome",
        versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/, Ee],
        search: function (n) {
          return Z(n, "chrome") && !Z(n, "chromeframe");
        },
      },
      {
        name: "IE",
        versionRegexes: [
          /.*?msie ?([0-9]+)\.([0-9]+).*/,
          /.*?rv:([0-9]+)\.([0-9]+).*/,
        ],
        search: function (n) {
          return Z(n, "msie") || Z(n, "trident");
        },
      },
      {
        name: "Opera",
        versionRegexes: [Ee, /.*?opera\/([0-9]+)\.([0-9]+).*/],
        search: pn("opera"),
      },
      {
        name: "Firefox",
        versionRegexes: [/.*?firefox\/ ?([0-9]+)\.([0-9]+).*/],
        search: pn("firefox"),
      },
      {
        name: "Safari",
        versionRegexes: [Ee, /.*?cpu os ([0-9]+)_([0-9]+).*/],
        search: function (n) {
          return (Z(n, "safari") || Z(n, "mobile/")) && Z(n, "applewebkit");
        },
      },
    ],
    Re = [
      {
        name: "Windows",
        search: pn("win"),
        versionRegexes: [/.*?windows nt ?([0-9]+)\.([0-9]+).*/],
      },
      {
        name: "iOS",
        search: function (n) {
          return Z(n, "iphone") || Z(n, "ipad");
        },
        versionRegexes: [
          /.*?version\/ ?([0-9]+)\.([0-9]+).*/,
          /.*cpu os ([0-9]+)_([0-9]+).*/,
          /.*cpu iphone os ([0-9]+)_([0-9]+).*/,
        ],
      },
      {
        name: "Android",
        search: pn("android"),
        versionRegexes: [/.*?android ?([0-9]+)\.([0-9]+).*/],
      },
      {
        name: "OSX",
        search: pn("os x"),
        versionRegexes: [/.*?os x ?([0-9]+)_([0-9]+).*/],
      },
      { name: "Linux", search: pn("linux"), versionRegexes: [] },
      { name: "Solaris", search: pn("sunos"), versionRegexes: [] },
      { name: "FreeBSD", search: pn("freebsd"), versionRegexes: [] },
    ],
    De = { browsers: m(Ae), oses: m(Re) },
    ke = Vn(
      (function (n, e) {
        var t = De.browsers(),
          r = De.oses(),
          o = Oe(t, n).fold(we.unknown, we.nu),
          u = Ne(r, n).fold(Ce.unknown, Ce.nu);
        return {
          browser: o,
          os: u,
          deviceType: (function (n, e, t, r) {
            var o = n.isiOS() && !0 === /ipad/i.test(t),
              u = n.isiOS() && !o,
              i = n.isiOS() || n.isAndroid(),
              c = i || r("(pointer:coarse)"),
              a = o || (!u && i && r("(min-device-width:768px)")),
              f = u || (i && !a),
              s = e.isSafari() && n.isiOS() && !1 === /safari/i.test(t),
              l = !f && !a && !s;
            return {
              isiPad: m(o),
              isiPhone: m(u),
              isTablet: m(a),
              isPhone: m(f),
              isTouch: m(c),
              isAndroid: n.isAndroid,
              isiOS: n.isiOS,
              isWebView: m(s),
              isDesktop: m(l),
            };
          })(u, o, n, e),
        };
      })(a.navigator.userAgent, function (n) {
        return a.window.matchMedia(n).matches;
      })
    ),
    Ie = Gn,
    je = Un,
    Me = (ke.get().browser.isIE(), gn),
    _e =
      (M("element", "offset"),
      function (n, e) {
        var t = [];
        return (
          A(On(n), function (n) {
            e(n) && (t = t.concat([n])), (t = t.concat(_e(n, e)));
          }),
          t
        );
      });
  function Pe(n, e, t) {
    for (var r = n.dom(), o = _n(t) ? t : m(!1); r.parentNode; ) {
      r = r.parentNode;
      var u = Kn.fromDom(r);
      if (e(u)) return kn.some(u);
      if (o(u)) break;
    }
    return kn.none();
  }
  function Be(n, e, t) {
    return Pe(
      n,
      function (n) {
        return gn(n, e);
      },
      t
    );
  }
  function qe(n, e) {
    return (function (n, e) {
      return p(n.dom().childNodes, function (n) {
        return e(Kn.fromDom(n));
      }).map(Kn.fromDom);
    })(n, function (n) {
      return gn(n, e);
    });
  }
  function Le(n, e) {
    return (function (n, e) {
      var t = void 0 === e ? a.document : e.dom();
      return wn(t) ? kn.none() : kn.from(t.querySelector(n)).map(Kn.fromDom);
    })(e, n);
  }
  function ze(n, e, t) {
    return (function (n, e, t, r, o) {
      return n(t, r) ? kn.some(t) : _n(o) && o(t) ? kn.none() : e(t, r, o);
    })(gn, Be, n, e, t);
  }
  function Ve(n, e, t) {
    return (
      void 0 === t && (t = s),
      t(e)
        ? kn.none()
        : l(n, F(e))
        ? kn.some(e)
        : Be(e, n.join(","), function (n) {
            return gn(n, "table") || t(n);
          })
    );
  }
  function Fe(e, n) {
    return Sn(n).map(function (n) {
      return An(n, e);
    });
  }
  function We(e, t) {
    Sn(e).each(function (n) {
      n.dom().insertBefore(t.dom(), e.dom());
    });
  }
  function Ue(n, e) {
    Cn(n).fold(
      function () {
        Sn(n).each(function (n) {
          at(n, e);
        });
      },
      function (n) {
        We(n, e);
      }
    );
  }
  function Ge(e, t) {
    Nn(e).fold(
      function () {
        at(e, t);
      },
      function (n) {
        e.dom().insertBefore(t.dom(), n.dom());
      }
    );
  }
  function Ye(n, e) {
    We(n, e), at(e, n);
  }
  function He(r, o) {
    A(o, function (n, e) {
      var t = 0 === e ? r : o[e - 1];
      Ue(t, n);
    });
  }
  function Xe(e, n) {
    A(n, function (n) {
      at(e, n);
    });
  }
  function $e(n) {
    (n.dom().textContent = ""),
      A(On(n), function (n) {
        ft(n);
      });
  }
  function Ke(n) {
    var e = On(n);
    0 < e.length &&
      (function (e, n) {
        A(n, function (n) {
          We(e, n);
        });
      })(n, e),
      ft(n);
  }
  function Je(n, e) {
    return Kn.fromDom(n.dom().cloneNode(e));
  }
  function Qe(n) {
    return Je(n, !1);
  }
  function Ze(n) {
    return Je(n, !0);
  }
  function nt(n, e) {
    var t = (function (n, e) {
        var t = Kn.fromTag(e),
          r = Q(n);
        return X(t, r), t;
      })(n, e),
      r = On(Ze(n));
    return Xe(t, r), t;
  }
  function et(n, e, t, r) {
    t === r ? J(n, e) : H(n, e, t);
  }
  var tt = function (n, e, t) {
      return k(On(n), function (n) {
        return gn(n, e) ? (t(n) ? [n] : []) : tt(n, e, t);
      });
    },
    rt = function (n, e) {
      return tt(n, e, m(!0));
    },
    ot =
      (i(Fe, "th,td"),
      i(Fe, "tr"),
      function (n, e) {
        return Ve(["td", "th"], n, e);
      }),
    ut = function (n) {
      return rt(n, "th,td");
    },
    it = function (n, e) {
      return ze(n, "table", e);
    },
    ct = function (n) {
      return rt(n, "tr");
    },
    at = function (n, e) {
      n.dom().appendChild(e.dom());
    },
    ft = function (n) {
      var e = n.dom();
      null !== e.parentNode && e.parentNode.removeChild(e);
    },
    st = function (o, n) {
      function e(n, e) {
        0 < n.length
          ? (function (n, e) {
              var t = qe(o, e).getOrThunk(function () {
                var n = Kn.fromTag(e, yn(o).dom());
                return at(o, n), n;
              });
              $e(t);
              var r = E(n, function (n) {
                n.isNew() && u.push(n.element());
                var e = n.element();
                return (
                  $e(e),
                  A(n.cells(), function (n) {
                    n.isNew() && i.push(n.element()),
                      et(n.element(), "colspan", n.colspan(), 1),
                      et(n.element(), "rowspan", n.rowspan(), 1),
                      at(e, n.element());
                  }),
                  e
                );
              });
              Xe(t, r);
            })(n, e)
          : (function (n) {
              qe(o, n).each(ft);
            })(e);
      }
      var u = [],
        i = [],
        t = [],
        r = [],
        c = [];
      return (
        A(n, function (n) {
          switch (n.section()) {
            case "thead":
              t.push(n);
              break;
            case "tbody":
              r.push(n);
              break;
            case "tfoot":
              c.push(n);
          }
        }),
        e(t, "thead"),
        e(r, "tbody"),
        e(c, "tfoot"),
        { newRows: m(u), newCells: m(i) }
      );
    };
  function lt(r, o) {
    function n(n) {
      var e = o(n);
      if (e <= 0 || null === e) {
        var t = un(n, r);
        return parseFloat(t) || 0;
      }
      return e;
    }
    function u(o, n) {
      return D(
        n,
        function (n, e) {
          var t = un(o, e),
            r = void 0 === t ? 0 : parseInt(t, 10);
          return isNaN(r) ? n : n + r;
        },
        0
      );
    }
    return {
      set: function (n, e) {
        if (!Pn(e) && !e.match(/^[0-9]+$/))
          throw new Error(
            r + ".set accepts only positive integer values. Value was " + e
          );
        var t = n.dom();
        nn(t) && (t.style[r] = e + "px");
      },
      get: n,
      getOuter: n,
      aggregate: u,
      max: function (n, e, t) {
        var r = u(n, t);
        return r < e ? e - r : 0;
      },
    };
  }
  function mt(n) {
    return zt.getOuter(n);
  }
  function dt(n, e) {
    return void 0 !== n ? n : void 0 !== e ? e : 0;
  }
  function vt(n) {
    var e = n.dom().ownerDocument,
      t = e.body,
      r = e.defaultView,
      o = e.documentElement;
    if (t === n.dom()) return Ft(t.offsetLeft, t.offsetTop);
    var u = dt(r.pageYOffset, o.scrollTop),
      i = dt(r.pageXOffset, o.scrollLeft),
      c = dt(o.clientTop, t.clientTop),
      a = dt(o.clientLeft, t.clientLeft);
    return Wt(n).translate(i - a, u - c);
  }
  function ht(n) {
    return Ut.getOuter(n);
  }
  function pt(n) {
    return vt(n).left() + ht(n);
  }
  function gt(n) {
    return vt(n).left();
  }
  function wt(n, e) {
    return Yt(n, gt(e));
  }
  function bt(n, e) {
    return Yt(n, pt(e));
  }
  function yt(n) {
    return vt(n).top();
  }
  function St(n, e) {
    return Gt(n, yt(e));
  }
  function Tt(n, e) {
    return Gt(n, yt(e) + mt(e));
  }
  function xt(t, e, r) {
    if (0 === r.length) return [];
    var n = E(r.slice(1), function (n, e) {
        return n.map(function (n) {
          return t(e, n);
        });
      }),
      o = r[r.length - 1].map(function (n) {
        return e(r.length - 1, n);
      });
    return n.concat([o]);
  }
  function Ct(n, e) {
    var t = $(n, e);
    return void 0 === t || "" === t ? [] : t.split(" ");
  }
  function Ot(n) {
    return void 0 !== n.dom().classList;
  }
  function Nt(n, e) {
    return (function (n, e, t) {
      var r = Ct(n, e).concat([t]);
      return H(n, e, r.join(" ")), !0;
    })(n, "class", e);
  }
  function Et(n, e) {
    Ot(n) ? n.dom().classList.add(e) : Nt(n, e);
  }
  function At(n, e) {
    return n + "," + e;
  }
  function Rt(n, e) {
    for (var t = [], r = n; r < e; r++) t.push(r);
    return t;
  }
  function Dt(n) {
    var e = Rn(n.parent(), "." + rr);
    A(e, ft);
  }
  function kt(t, n, r) {
    var o = t.origin();
    A(n, function (n, e) {
      n.each(function (n) {
        var e = r(o, n);
        Et(e, rr), at(t.parent(), e);
      });
    });
  }
  function It(n, e, t, r, o, u) {
    var i = vt(e);
    !(function (n, e, r, o) {
      kt(n, e, function (n, e) {
        var t = tr(e.row(), r.left() - n.left(), e.y() - n.top(), o, 7);
        return Et(t, or), t;
      });
    })(n, 0 < t.length ? o.positions(t, e) : [], i, ht(e)),
      (function (n, e, r, o) {
        kt(n, e, function (n, e) {
          var t = er(e.col(), e.x() - n.left(), r.top() - n.top(), 7, o);
          return Et(t, ur), t;
        });
      })(n, 0 < r.length ? u.positions(r, e) : [], i, mt(e));
  }
  function jt(n, e) {
    if (0 === n.length) return 0;
    var t = n[0];
    return g(n, function (n) {
      return !e(t.element(), n.element());
    }).fold(
      function () {
        return n.length;
      },
      function (n) {
        return n;
      }
    );
  }
  function Mt(n, e) {
    function t(n) {
      return (function (n, e) {
        for (var t = 0; t < n.length; t++) {
          var r = e(n[t], t);
          if (r.isSome()) return r;
        }
        return kn.none();
      })(n, function (n) {
        return Sn(n.element()).map(function (n) {
          var e = Sn(n).isNone();
          return ue(n, e);
        });
      }).getOrThunk(function () {
        return ue(e.row(), !0);
      });
    }
    return E(n, function (n) {
      var e = t(n.details());
      return ie(e.element(), n.details(), n.section(), e.isNew());
    });
  }
  function _t(n, e) {
    var t = w(
      E(n.all(), function (n) {
        return n.cells();
      })
    );
    return p(t, function (n) {
      return bn(e, n.element());
    });
  }
  function Pt(c, a, f, s, l) {
    return function (t, r, n, o, u) {
      var e = Zt(r),
        i = $t.generate(e);
      return a(i, n)
        .map(function (n) {
          var e = (function (n, e) {
              return fr(n, e, !1);
            })(i, o),
            t = c(e, n, bn, l(o)),
            r = (function (n, e) {
              var t = ar(n, bn);
              return Mt(t, e);
            })(t.grid(), o);
          return { grid: m(r), cursor: t.cursor };
        })
        .fold(
          function () {
            return kn.none();
          },
          function (n) {
            var e = st(r, n.grid());
            return (
              f(r, n.grid(), u),
              s(r),
              ir(t, r, Ht.height, u),
              kn.some({
                cursor: n.cursor,
                newRows: e.newRows,
                newCells: e.newCells,
              })
            );
          }
        );
    };
  }
  function Bt(e, n) {
    return ot(n.element()).bind(function (n) {
      return _t(e, n);
    });
  }
  function qt(e, n) {
    var t = (function (n) {
      for (
        var e = [],
          t = function (n) {
            e.push(n);
          },
          r = 0;
        r < n.length;
        r++
      )
        n[r].each(t);
      return e;
    })(
      E(n.selection(), function (n) {
        return ot(n).bind(function (n) {
          return _t(e, n);
        });
      })
    );
    return 0 < t.length ? kn.some(t) : kn.none();
  }
  var Lt,
    zt = lt("height", function (n) {
      var e = n.dom();
      return en(n) ? e.getBoundingClientRect().height : e.offsetHeight;
    }),
    Vt = function (t, r) {
      return {
        left: m(t),
        top: m(r),
        translate: function (n, e) {
          return Vt(t + n, r + e);
        },
      };
    },
    Ft = Vt,
    Wt = function (n) {
      var e = n.dom(),
        t = e.ownerDocument.body;
      return t === e
        ? Ft(t.offsetLeft, t.offsetTop)
        : en(n)
        ? (function (n) {
            var e = n.getBoundingClientRect();
            return Ft(e.left, e.top);
          })(e)
        : Ft(0, 0);
    },
    Ut = lt("width", function (n) {
      return n.dom().offsetWidth;
    }),
    Gt = M("row", "y"),
    Yt = M("col", "x"),
    Ht = {
      height: {
        delta: t,
        positions: function (n) {
          return xt(St, Tt, n);
        },
        edge: yt,
      },
      rtl: {
        delta: function (n) {
          return -n;
        },
        edge: pt,
        positions: function (n) {
          return xt(bt, wt, n);
        },
      },
      ltr: {
        delta: t,
        edge: gt,
        positions: function (n) {
          return xt(wt, bt, n);
        },
      },
    },
    Xt = function (n, e) {
      var t = k(n.all(), function (n) {
        return n.cells();
      });
      return v(t, e);
    },
    $t = {
      generate: function (n) {
        var f = {},
          e = [],
          t = n.length,
          s = 0;
        A(n, function (n, c) {
          var a = [];
          A(n.cells(), function (n) {
            for (var e = 0; void 0 !== f[At(c, e)]; ) e++;
            for (
              var t = re(n.element(), n.rowspan(), n.colspan(), c, e), r = 0;
              r < n.colspan();
              r++
            )
              for (var o = 0; o < n.rowspan(); o++) {
                var u = e + r,
                  i = At(c + o, u);
                (f[i] = t), (s = Math.max(s, u + 1));
              }
            a.push(t);
          }),
            e.push(oe(n.element(), a, n.section()));
        });
        var r = ne(t, s);
        return { grid: m(r), access: m(f), all: m(e) };
      },
      getAt: function (n, e, t) {
        var r = n.access()[At(e, t)];
        return void 0 !== r ? kn.some(r) : kn.none();
      },
      findItem: function (n, e, t) {
        var r = Xt(n, function (n) {
          return t(e, n.element());
        });
        return 0 < r.length ? kn.some(r[0]) : kn.none();
      },
      filterItems: Xt,
      justCells: function (n) {
        var e = E(n.all(), function (n) {
          return n.cells();
        });
        return w(e);
      },
    },
    Kt = function (n, e, t) {
      var r = n();
      return p(r, e)
        .orThunk(function () {
          return kn.from(r[0]).orThunk(t);
        })
        .map(function (n) {
          return n.element();
        });
    },
    Jt = function (t) {
      var n = t.grid(),
        e = Rt(0, n.columns()),
        r = Rt(0, n.rows());
      return E(e, function (e) {
        return Kt(
          function () {
            return k(r, function (n) {
              return $t
                .getAt(t, n, e)
                .filter(function (n) {
                  return n.column() === e;
                })
                .fold(m([]), function (n) {
                  return [n];
                });
            });
          },
          function (n) {
            return 1 === n.colspan();
          },
          function () {
            return $t.getAt(t, 0, e);
          }
        );
      });
    },
    Qt = function (t) {
      var n = t.grid(),
        e = Rt(0, n.rows()),
        r = Rt(0, n.columns());
      return E(e, function (e) {
        return Kt(
          function () {
            return k(r, function (n) {
              return $t
                .getAt(t, e, n)
                .filter(function (n) {
                  return n.row() === e;
                })
                .fold(m([]), function (n) {
                  return [n];
                });
            });
          },
          function (n) {
            return 1 === n.rowspan();
          },
          function () {
            return $t.getAt(t, e, 0);
          }
        );
      });
    },
    Zt = function (n) {
      var e = ct(n);
      return E(e, function (n) {
        var e = n,
          t = Sn(e)
            .map(function (n) {
              var e = F(n);
              return "tfoot" === e || "thead" === e || "tbody" === e
                ? e
                : "tbody";
            })
            .getOr("tbody"),
          r = E(ut(n), function (n) {
            var e = K(n, "rowspan") ? parseInt($(n, "rowspan"), 10) : 1,
              t = K(n, "colspan") ? parseInt($(n, "colspan"), 10) : 1;
            return ee(n, e, t);
          });
        return oe(e, r, t);
      });
    },
    nr = {
      resolve: ((Lt = "ephox-snooker".replace(/\./g, "-")),
      {
        resolve: function (n) {
          return Lt + "-" + n;
        },
      }).resolve,
    },
    er = function (n, e, t, r, o) {
      var u = Kn.fromTag("div");
      return (
        on(u, {
          position: "absolute",
          left: e - r / 2 + "px",
          top: t + "px",
          height: o + "px",
          width: r + "px",
        }),
        X(u, { "data-column": n, role: "presentation" }),
        u
      );
    },
    tr = function (n, e, t, r, o) {
      var u = Kn.fromTag("div");
      return (
        on(u, {
          position: "absolute",
          left: e + "px",
          top: t - o / 2 + "px",
          height: o + "px",
          width: r + "px",
        }),
        X(u, { "data-row": n, role: "presentation" }),
        u
      );
    },
    rr = nr.resolve("resizer-bar"),
    or = nr.resolve("resizer-rows"),
    ur = nr.resolve("resizer-cols"),
    ir = function (n, e, t, r) {
      Dt(n);
      var o = Zt(e),
        u = $t.generate(o),
        i = Qt(u),
        c = Jt(u);
      It(n, e, i, c, t, r);
    },
    cr = function (n, e, t, r) {
      var o = (function (n, e) {
          return n[e];
        })(n, e)
          .cells()
          .slice(t),
        u = jt(o, r),
        i = (function (n, e) {
          return E(n, function (n) {
            return se(n, e);
          });
        })(n, t).slice(e),
        c = jt(i, r);
      return { colspan: m(u), rowspan: m(c) };
    },
    ar = function (o, u) {
      var i = E(o, function (n, e) {
        return E(n.cells(), function (n, e) {
          return !1;
        });
      });
      return E(o, function (n, r) {
        var e = k(n.cells(), function (n, e) {
          if (!1 !== i[r][e]) return [];
          var t = cr(o, r, e, u);
          return (
            (function (n, e, t, r) {
              for (var o = n; o < n + t; o++)
                for (var u = e; u < e + r; u++) i[o][u] = !0;
            })(r, e, t.rowspan(), t.colspan()),
            [te(n.element(), t.rowspan(), t.colspan(), n.isNew())]
          );
        });
        return ae(e, n.section());
      });
    },
    fr = function (n, e, t) {
      for (var r = [], o = 0; o < n.grid().rows(); o++) {
        for (var u = [], i = 0; i < n.grid().columns(); i++) {
          var c = $t
            .getAt(n, o, i)
            .map(function (n) {
              return ue(n.element(), t);
            })
            .getOrThunk(function () {
              return ue(e.gap(), !0);
            });
          u.push(c);
        }
        var a = ce(u, n.all()[o].section());
        r.push(a);
      }
      return r;
    },
    sr = { ltr: Ht.ltr, rtl: Ht.rtl };
  function lr(e) {
    function t(n) {
      return e(n).isRtl() ? sr.rtl : sr.ltr;
    }
    return {
      delta: function (n, e) {
        return t(e).delta(n, e);
      },
      edge: function (n) {
        return t(n).edge(n);
      },
      positions: function (n, e) {
        return t(e).positions(n, e);
      },
    };
  }
  function mr(n) {
    return Dr.get(n);
  }
  function dr(n, e) {
    Dr.set(n, e);
  }
  function vr(n) {
    return (function (n) {
      return Dr.getOption(n);
    })(n)
      .filter(function (n) {
        return 0 !== n.trim().length || -1 < n.indexOf("聽");
      })
      .isSome();
  }
  function hr(n) {
    return vr(n) || l(kr, F(n));
  }
  function pr(n) {
    return (function (n, o) {
      var u = function (n) {
        for (var e = 0; e < n.childNodes.length; e++) {
          var t = Kn.fromDom(n.childNodes[e]);
          if (o(t)) return kn.some(t);
          var r = u(n.childNodes[e]);
          if (r.isSome()) return r;
        }
        return kn.none();
      };
      return u(n.dom());
    })(n, hr);
  }
  function gr() {
    var n = Kn.fromTag("td");
    return at(n, Kn.fromTag("br")), n;
  }
  function wr(n, e, t) {
    var r = nt(n, e);
    return (
      _(t, function (n, e) {
        null === n ? J(r, e) : H(r, e, n);
      }),
      r
    );
  }
  function br(n) {
    return function () {
      return Kn.fromTag("tr", n.dom());
    };
  }
  function yr(n) {
    return n.dom().textContent;
  }
  function Sr(n) {
    return n.getBoundingClientRect().width;
  }
  function Tr(n) {
    return Kn.fromDom(n.getBody());
  }
  function xr(n) {
    var e = Rn(n, "td[data-mce-style],th[data-mce-style]");
    J(n, "data-mce-style"),
      A(e, function (n) {
        J(n, "data-mce-style");
      });
  }
  function Cr(n) {
    var e = parseFloat(n);
    return isNaN(e) ? kn.none() : kn.some(e);
  }
  function Or(n, e) {
    return n < e ? -1 : e < n ? 1 : 0;
  }
  function Nr(n, e) {
    return (function (n, e, t) {
      return n.isSome() && e.isSome()
        ? kn.some(t(n.getOrDie(), e.getOrDie()))
        : kn.none();
    })(Cr(n), Cr(e), Or).getOrThunk(function () {
      return (function (n, e) {
        return n.localeCompare(e);
      })(n, e);
    });
  }
  var Er,
    Ar,
    Rr,
    Dr =
      ((Er = Xn),
      {
        get: function (n) {
          if (!Er(n))
            throw new Error(
              "Can only get " + Ar + " value of a " + Ar + " node"
            );
          return Rr(n).getOr("");
        },
        getOption: (Rr = function (n) {
          return Er(n) ? kn.from(n.dom().nodeValue) : kn.none();
        }),
        set: function (n, e) {
          if (!Er(n))
            throw new Error(
              "Can only set raw " + Ar + " value of a " + Ar + " node"
            );
          n.dom().nodeValue = e;
        },
      }),
    kr = ["img", "br"],
    Ir = function (u, n, i) {
      return {
        row: br(n),
        cell: function (n) {
          var e = yn(n.element()),
            t = Kn.fromTag(F(n.element()), e.dom()),
            r = i.getOr([
              "strong",
              "em",
              "b",
              "i",
              "span",
              "font",
              "h1",
              "h2",
              "h3",
              "h4",
              "h5",
              "h6",
              "p",
              "div",
            ]),
            o =
              0 < r.length
                ? (function (r, o, u) {
                    return pr(r)
                      .map(function (n) {
                        var e = u.join(","),
                          t = En(n, e, function (n) {
                            return bn(n, r);
                          });
                        return h(
                          t,
                          function (n, e) {
                            var t = Qe(e);
                            return J(t, "contenteditable"), at(n, t), t;
                          },
                          o
                        );
                      })
                      .getOr(o);
                  })(n.element(), t, r)
                : t;
          return (
            at(o, Kn.fromTag("br")),
            (function (n, e) {
              var t = n.dom(),
                r = e.dom();
              nn(t) && nn(r) && (r.style.cssText = t.style.cssText);
            })(n.element(), t),
            an(t, "height"),
            1 !== n.colspan() && an(n.element(), "width"),
            u(n.element(), t),
            t
          );
        },
        replace: wr,
        gap: gr,
      };
    },
    jr = { isRtl: m(!(Ar = "text")) },
    Mr = { isRtl: m(!0) },
    _r = function (n) {
      return "rtl" ===
        (function (n) {
          return "rtl" === un(n, "direction") ? "rtl" : "ltr";
        })(n)
        ? Mr
        : jr;
    };
  function Pr(f, s) {
    function e(i, c, a) {
      return function (n, e) {
        xr(n);
        var t = s().resizeHandler.lazyWire(),
          r = Kn.fromDom(f.getDoc()),
          o = lr(_r),
          u = Ir(a, r, y);
        return c(n)
          ? i(t, n, e, u, o).bind(function (n) {
              return (
                A(n.newRows(), function (n) {
                  !(function (n, e) {
                    n.fire("newrow", { node: e });
                  })(f, n.dom());
                }),
                A(n.newCells(), function (n) {
                  !(function (n, e) {
                    n.fire("newcell", { node: e });
                  })(f, n.dom());
                }),
                n.cursor().map(function (n) {
                  var e = f.dom.createRng();
                  return e.setStart(n.dom(), 0), e.setEnd(n.dom(), 0), e;
                })
              );
            })
          : kn.none();
      };
    }
    function a(n, e, t) {
      return S(
        n,
        (function (n, e, t) {
          return kn.from(n[e]).bind(function (n) {
            return kn.from(n.cells()[t]).bind(function (n) {
              return kn.from(n.element());
            });
          });
        })(n, e, t)
      );
    }
    function l(n, r, o, u) {
      var e = R(n, function (n) {
          return n.section();
        }),
        t = E(e, function (n) {
          return R(n, function (n) {
            return F(se(n, r).element());
          });
        });
      return k(t, function (n) {
        return k(n, function (n) {
          return "th" === F(se(n[0], r).element())
            ? n
            : (function (n) {
                var e = E(n, function (n) {
                    var e = se(n, r);
                    return { row: n, text: yr(e.element()) };
                  }),
                  t = I(e, function (n, e) {
                    var t = o(n.text, e.text);
                    return u ? t : -1 * t;
                  });
                return E(t, function (n) {
                  return n.row;
                });
              })(n);
        });
      });
    }
    function m(n, e, o, u) {
      var t = n[e].cells(),
        r = E(t, function (n) {
          return yr(n.element());
        }),
        i = E(n, function (n) {
          return {
            zippedCells: E(n.cells(), function (n, e) {
              return { cell: n, reference: t[e], referenceText: r[e] };
            }),
            section: n.section(),
          };
        });
      return E(i, function (n) {
        var e = R(n.zippedCells, function (n) {
            return F(n.reference.element());
          }),
          t = k(e, function (n) {
            return "th" === F(n[0].reference.element())
              ? n
              : I(n, function (n, e) {
                  var t = o(n.referenceText, e.referenceText);
                  return u ? t : -1 * t;
                });
          }),
          r = E(t, function (n) {
            return n.cell;
          });
        return ce(r, n.section);
      });
    }
    function d(n, e, t, r, o) {
      var u = n.slice(0, e),
        i = n.slice(e, t + 1);
      return {
        beforeRows: u,
        afterRows: n.slice(t + 1, n.length),
        selectionGridBefore: i.map(function (n) {
          return {
            cells: function () {
              return n.cells().slice(0, r);
            },
            section: function () {
              return n.section();
            },
          };
        }),
        selectionGrid: i.map(function (n) {
          return {
            cells: function () {
              return n.cells().slice(r, o + 1);
            },
            section: function () {
              return n.section();
            },
          };
        }),
        selectionGridAfter: i.map(function (n) {
          return {
            cells: function () {
              return n.cells().slice(o + 1, n.cells().length);
            },
            section: function () {
              return n.section();
            },
          };
        }),
      };
    }
    function v(o, n) {
      var e = E(n, function (n, e) {
        var t = o.selectionGridBefore[e].cells(),
          r = o.selectionGridAfter[e].cells();
        return {
          cells: function () {
            return t.concat(n.cells()).concat(r);
          },
          section: function () {
            return n.section();
          },
        };
      });
      return o.beforeRows.concat(e).concat(o.afterRows);
    }
    function h(n, e, t, r, o, u, i, c) {
      var a = d(n, t, r, o, u),
        f = l(a.selectionGrid, e - o, i, c);
      return v(a, f);
    }
    function p(n, e, t, r, o, u, i, c) {
      var a = d(n, t, r, o, u),
        f = m(a.selectionGrid, e - t, i, c);
      return v(a, f);
    }
    function g(n) {
      return D(
        n,
        function (n, e) {
          return N(n, function (n) {
            return n.row() === e.row();
          })
            ? n
            : n.concat([e]);
        },
        []
      ).sort(function (n, e) {
        return n.row() - e.row();
      });
    }
    function w(n) {
      return D(
        n,
        function (n, e) {
          return N(n, function (n) {
            return n.column() === e.column();
          })
            ? n
            : n.concat([e]);
        },
        []
      ).sort(function (n, e) {
        return n.column() - e.column();
      });
    }
    function t(n, e, t, r, o) {
      var u = h(n, o, 0, n.length, o, o, t, r);
      return a(u, e[0].row(), e[0].column());
    }
    function r(n, e, t, r, o) {
      var u = g(e),
        i = w(e),
        c = h(
          n,
          o,
          u[0].row(),
          u[u.length - 1].row(),
          i[0].column(),
          i[i.length - 1].column(),
          t,
          r
        );
      return a(c, e[0].row(), e[0].column());
    }
    function o(n, e, t, r, o) {
      var u = T(n, o, t, r);
      return a(u, e.row(), e.column());
    }
    function u(n, e, t, r, o) {
      var u = p(n, o, o, o, 0, n[e[0].row()].cells().length, t, r);
      return a(u, e[0].row(), e[0].column());
    }
    function i(n, e, t, r, o) {
      var u = g(e),
        i = w(e),
        c = p(
          n,
          o,
          u[0].row(),
          u[u.length - 1].row(),
          i[0].column(),
          i[i.length - 1].column(),
          t,
          r
        );
      return a(c, e[0].row(), e[0].column());
    }
    function c(n, e, t, r, o) {
      var u = x(n, o, t, r);
      return a(u, e.row(), e.column());
    }
    function b(u, i, c, a, f) {
      return function (n, e, t, r, o) {
        return Pt(
          function (n, e) {
            return u(n, e, i, c, a);
          },
          f,
          C,
          C,
          Zn
        )(n, e, t, r, o);
      };
    }
    var y = (function (n) {
        var e = n.getParam("table_clone_elements");
        return In(e)
          ? kn.some(e.split(/[ ,]/))
          : Array.isArray(e)
          ? kn.some(e)
          : kn.none();
      })(f),
      S = M("grid", "cursor"),
      T = l,
      x = m;
    return {
      sortColumnRowsAsc: function (n) {
        return e(b(t, Nr, !0, n, qt), O, C);
      },
      sortColumnRowsDesc: function (n) {
        return e(b(t, Nr, !1, n, qt), O, C);
      },
      sortSelectionRowsAsc: function (n) {
        return e(b(r, Nr, !0, n, qt), O, C);
      },
      sortSelectionRowsDesc: function (n) {
        return e(b(r, Nr, !1, n, qt), O, C);
      },
      sortTableRowsAsc: function (n) {
        return e(b(o, Nr, !0, n, Bt), O, C);
      },
      sortTableRowsDesc: function (n) {
        return e(b(o, Nr, !1, n, Bt), O, C);
      },
      sortRowColumnsAsc: function (n) {
        return e(b(u, Nr, !0, n, qt), O, C);
      },
      sortRowColumnsDesc: function (n) {
        return e(b(u, Nr, !1, n, qt), O, C);
      },
      sortSelectionColumnsAsc: function (n) {
        return e(b(i, Nr, !0, n, qt), O, C);
      },
      sortSelectionColumnsDesc: function (n) {
        return e(b(i, Nr, !1, n, qt), O, C);
      },
      sortTableColumnsAsc: function (n) {
        return e(b(c, Nr, !0, n, Bt), O, C);
      },
      sortTableColumnsDesc: function (n) {
        return e(b(c, Nr, !1, n, Bt), O, C);
      },
    };
  }
  function Br(n, e) {
    return (
      e.column() >= n.startCol() &&
      e.column() + e.colspan() - 1 <= n.finishCol() &&
      e.row() >= n.startRow() &&
      e.row() + e.rowspan() - 1 <= n.finishRow()
    );
  }
  function qr(n, e, t) {
    var r = $t.findItem(n, e, bn),
      o = $t.findItem(n, t, bn);
    return r.bind(function (e) {
      return o.map(function (n) {
        return (function (n, e) {
          return fe(
            Math.min(n.row(), e.row()),
            Math.min(n.column(), e.column()),
            Math.max(n.row() + n.rowspan() - 1, e.row() + e.rowspan() - 1),
            Math.max(n.column() + n.colspan() - 1, e.column() + e.colspan() - 1)
          );
        })(e, n);
      });
    });
  }
  var Lr = function (o, u, e) {
      function t(n) {
        J(n, o.selected()), J(n, o.firstSelected()), J(n, o.lastSelected());
      }
      function i(n) {
        H(n, o.selected(), "1");
      }
      function c(n) {
        r(n), e();
      }
      var r = function (n) {
        var e = Rn(n, o.selectedSelector());
        A(e, t);
      };
      return {
        clearBeforeUpdate: r,
        clear: c,
        selectRange: function (n, e, t, r) {
          c(n),
            A(e, i),
            H(t, o.firstSelected(), "1"),
            H(r, o.lastSelected(), "1"),
            u(e, t, r);
        },
        selectedSelector: o.selectedSelector,
        firstSelectedSelector: o.firstSelectedSelector,
        lastSelectedSelector: o.lastSelectedSelector,
      };
    },
    zr = function (n, e) {
      for (var t = !0, r = i(Br, e), o = e.startRow(); o <= e.finishRow(); o++)
        for (var u = e.startCol(); u <= e.finishCol(); u++)
          t = t && $t.getAt(n, o, u).exists(r);
      return t ? kn.some(e) : kn.none();
    },
    Vr = function (e, n, t) {
      return qr(e, n, t).bind(function (n) {
        return zr(e, n);
      });
    },
    Fr = function (n) {
      var e = Zt(n);
      return $t.generate(e);
    },
    Wr = function (n, e, t) {
      var r = Fr(n);
      return Vr(r, e, t);
    },
    Ur = [
      "body",
      "p",
      "div",
      "article",
      "aside",
      "figcaption",
      "figure",
      "footer",
      "header",
      "nav",
      "section",
      "ol",
      "ul",
      "li",
      "table",
      "thead",
      "tbody",
      "tfoot",
      "caption",
      "tr",
      "td",
      "th",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6",
      "blockquote",
      "pre",
      "address",
    ];
  function Gr(n, e, t) {
    var r = n.property().children(e);
    return g(r, i(n.eq, t)).map(function (n) {
      return { before: m(r.slice(0, n)), after: m(r.slice(n + 1)) };
    });
  }
  function Yr(n, e) {
    return i(n.eq, e);
  }
  function Hr(o, u, n, e) {
    var i = o.property().children(u);
    if (o.eq(u, n[0])) return kn.some([n[0]]);
    if (o.eq(u, e[0])) return kn.some([e[0]]);
    function t(n) {
      var e = (function (n) {
          var e = Bn.call(n, 0);
          return e.reverse(), e;
        })(n),
        t = g(e, Yr(o, u)).getOr(-1),
        r = t < e.length - 1 ? e[t + 1] : e[t];
      return g(i, Yr(o, r));
    }
    var r = t(n),
      c = t(e);
    return r.bind(function (r) {
      return c.map(function (n) {
        var e = Math.min(r, n),
          t = Math.max(r, n);
        return i.slice(e, t + 1);
      });
    });
  }
  function Xr(e, n, t, r) {
    function o(e) {
      return g(e, r).fold(
        function () {
          return e;
        },
        function (n) {
          return e.slice(0, n + 1);
        }
      );
    }
    void 0 === r && (r = s);
    var u = [n].concat(e.up().all(n)),
      i = [t].concat(e.up().all(t)),
      c = o(u),
      a = o(i),
      f = p(c, function (n) {
        return N(a, Yr(e, n));
      });
    return { firstpath: m(c), secondpath: m(a), shared: m(f) };
  }
  function $r(n) {
    return Be(n, "table");
  }
  function Kr(n, e) {
    return bo.cata(e.get(), m([]), t, m([n]));
  }
  function Jr(n, e) {
    var t = (function (e) {
      return function (n) {
        return bn(n, Tr(e));
      };
    })(e);
    return it(n, t);
  }
  function Qr(t) {
    return function (n) {
      var e = n.getData();
      n.close(),
        t.undoManager.transact(function () {
          t.execCommand("mceSortTableAdvanced", !1, e),
            t.focus(),
            t.addVisual();
        });
    };
  }
  function Zr(e, t, r) {
    function o(n) {
      return function () {
        return e.execCommand(n);
      };
    }
    e.on("init", function () {
      var n = [
        {
          type: "menuitem",
          text: "Sort table by column ascending",
          onAction: o("mceSortTableByColumnAsc"),
          onSetup: t().selectionTargets.onSetupCellOrRow,
        },
        {
          type: "menuitem",
          text: "Sort table by column descending",
          onAction: o("mceSortTableByColumnDesc"),
          onSetup: t().selectionTargets.onSetupCellOrRow,
        },
        { type: "separator" },
        {
          type: "menuitem",
          text: "Advanced sort...",
          onAction: function () {
            return No(e, r);
          },
          onSetup: t().selectionTargets.onSetupCellOrRow,
        },
      ];
      e.ui.registry.addNestedMenuItem("advtablesort", {
        type: "nestedmenuitem",
        text: "Sort",
        getSubmenuItems: function () {
          return n;
        },
      });
    });
  }
  function no(n) {
    var e, t;
    if (j(tinymce, "5.1.2"))
      return (
        console.error(
          "Please use Advanced Tables with TinyMCE 5.1.2 or later."
        ),
        {}
      );
    if (
      ((e = "table"),
      (t = n.settings.plugins ? n.settings.plugins : ""),
      l(t.split(/[ ,]/), e))
    ) {
      var r = function () {
          return n.plugins.table;
        },
        o = Pr(n, r),
        u = (function (e) {
          return {
            get: function () {
              var n = Tr(e);
              return lo(n, go.selectedSelector()).fold(
                function () {
                  return void 0 === e.selection.getStart()
                    ? bo.none()
                    : bo.single(e.selection);
                },
                function (n) {
                  return bo.multiple(n);
                }
              );
            },
          };
        })(n);
      Eo(n, o, u), Zr(n, r, u);
    } else
      console.log(
        "Please use the Advanced Tables Plugin together with the Tables plugin."
      );
    return {};
  }
  var eo,
    to = M("left", "right"),
    ro = M("first", "second", "splits"),
    oo = function (r, o, n, e) {
      var t = o(r, n);
      return h(
        e,
        function (n, e) {
          var t = o(r, e);
          return uo(r, n, t);
        },
        t
      );
    },
    uo = function (e, n, t) {
      return n.bind(function (n) {
        return t.filter(i(e.eq, n));
      });
    },
    io = {
      sharedOne: function (n, e, t) {
        return 0 < t.length
          ? (function (n, e, t, r) {
              return r(n, e, t[0], t.slice(1));
            })(n, e, t, oo)
          : kn.none();
      },
      subset: function (e, n, t) {
        var r = Xr(e, n, t);
        return r.shared().bind(function (n) {
          return Hr(e, n, r.firstpath(), r.secondpath());
        });
      },
      ancestors: Xr,
      breakToLeft: function (t, r, o) {
        return Gr(t, r, o).map(function (n) {
          var e = t.create().clone(r);
          return (
            t.insert().appendAll(e, n.before().concat([o])),
            t.insert().appendAll(r, n.after()),
            t.insert().before(r, e),
            to(e, r)
          );
        });
      },
      breakToRight: function (t, r, n) {
        return Gr(t, r, n).map(function (n) {
          var e = t.create().clone(r);
          return (
            t.insert().appendAll(e, n.after()), t.insert().after(r, e), to(r, e)
          );
        });
      },
      breakPath: function (u, n, i, c) {
        var a = function (n, e, o) {
          var t = ro(n, kn.none(), o);
          return i(n)
            ? ro(n, e, o)
            : u
                .property()
                .parent(n)
                .bind(function (r) {
                  return c(u, r, n).map(function (n) {
                    var e = [{ first: n.left, second: n.right }],
                      t = i(r) ? r : n.left();
                    return a(t, kn.some(n.right()), o.concat(e));
                  });
                })
                .getOr(t);
        };
        return a(n, kn.none(), []);
      },
    },
    co = {
      up: m({ selector: Be, closest: ze, predicate: Pe, all: Tn }),
      down: m({ selector: Rn, predicate: _e }),
      styles: m({ get: un, getRaw: cn, set: rn, remove: an }),
      attrs: m({
        get: $,
        set: H,
        remove: J,
        copyTo: function (n, e) {
          var t = Q(n);
          X(e, t);
        },
      }),
      insert: m({
        before: We,
        after: Ue,
        afterAll: He,
        append: at,
        appendAll: Xe,
        prepend: Ge,
        wrap: Ye,
      }),
      remove: m({ unwrap: Ke, remove: ft }),
      create: m({
        nu: Kn.fromTag,
        clone: function (n) {
          return Kn.fromDom(n.dom().cloneNode(!1));
        },
        text: Kn.fromText,
      }),
      query: m({
        comparePosition: function (n, e) {
          return n.dom().compareDocumentPosition(e.dom());
        },
        prevSibling: xn,
        nextSibling: Cn,
      }),
      property: m({
        children: On,
        name: F,
        parent: Sn,
        document: function (n) {
          return n.dom().ownerDocument;
        },
        isText: Xn,
        isComment: G,
        isElement: Hn,
        getText: mr,
        setText: dr,
        isBoundary: function (n) {
          return !!Hn(n) && ("body" === F(n) || l(Ur, F(n)));
        },
        isEmptyTag: function (n) {
          return !!Hn(n) && l(["br", "img", "hr", "input"], F(n));
        },
      }),
      eq: bn,
      is: Me,
    },
    ao = function (t, n) {
      return io.sharedOne(
        co,
        function (n, e) {
          return t(e);
        },
        n
      );
    },
    fo =
      ((function (n, e) {
        var t = n.concat(e);
        if (0 === t.length)
          throw new Error(
            "You must specify at least one required or optional field."
          );
        L("required", n), L("optional", e), z(t);
      })(["boxes", "start", "finish"], []),
      function (n, e) {
        var t = Rn(n, e);
        return 0 < t.length ? kn.some(t) : kn.none();
      }),
    so = function (n, e, r) {
      return Le(n, e).bind(function (t) {
        return Le(n, r).bind(function (e) {
          return ao($r, [t, e]).map(function (n) {
            return { first: m(t), last: m(e), table: m(n) };
          });
        });
      });
    },
    lo = function (n, e) {
      return fo(n, e);
    },
    mo = function (o, n, e) {
      return so(o, n, e).bind(function (t) {
        function n(n) {
          return bn(o, n);
        }
        var e = Be(t.first(), "thead,tfoot,tbody,table", n),
          r = Be(t.last(), "thead,tfoot,tbody,table", n);
        return e.bind(function (e) {
          return r.bind(function (n) {
            return bn(e, n) ? Wr(t.table(), t.first(), t.last()) : kn.none();
          });
        });
      });
    },
    vo = "data-mce-selected",
    ho = "data-mce-first-selected",
    po = "data-mce-last-selected",
    go = {
      selected: m(vo),
      selectedSelector: m("td[data-mce-selected],th[data-mce-selected]"),
      attributeSelector: m("[data-mce-selected]"),
      firstSelected: m(ho),
      firstSelectedSelector: m(
        "td[data-mce-first-selected],th[data-mce-first-selected]"
      ),
      lastSelected: m(po),
      lastSelectedSelector: m(
        "td[data-mce-last-selected],th[data-mce-last-selected]"
      ),
    },
    wo = (function (i) {
      if (!jn(i)) throw new Error("cases must be an array");
      if (0 === i.length) throw new Error("there must be at least one case");
      var c = [],
        t = {};
      return (
        A(i, function (n, r) {
          var e = zn(n);
          if (1 !== e.length) throw new Error("one and only one name per case");
          var o = e[0],
            u = n[o];
          if (void 0 !== t[o]) throw new Error("duplicate key detected:" + o);
          if ("cata" === o)
            throw new Error("cannot have a case named cata (sorry)");
          if (!jn(u)) throw new Error("case arguments must be an array");
          c.push(o),
            (t[o] = function () {
              var n = arguments.length;
              if (n !== u.length)
                throw new Error(
                  "Wrong number of arguments to case " +
                    o +
                    ". Expected " +
                    u.length +
                    " (" +
                    u +
                    "), got " +
                    n
                );
              for (var t = new Array(n), e = 0; e < t.length; e++)
                t[e] = arguments[e];
              return {
                fold: function () {
                  if (arguments.length !== i.length)
                    throw new Error(
                      "Wrong number of arguments to fold. Expected " +
                        i.length +
                        ", got " +
                        arguments.length
                    );
                  return arguments[r].apply(null, t);
                },
                match: function (n) {
                  var e = zn(n);
                  if (c.length !== e.length)
                    throw new Error(
                      "Wrong number of arguments to match. Expected: " +
                        c.join(",") +
                        "\nActual: " +
                        e.join(",")
                    );
                  if (
                    !b(c, function (n) {
                      return l(e, n);
                    })
                  )
                    throw new Error(
                      "Not all branches were specified when using match. Specified: " +
                        e.join(", ") +
                        "\nRequired: " +
                        c.join(", ")
                    );
                  return n[o].apply(null, t);
                },
                log: function (n) {
                  a.console.log(n, {
                    constructors: c,
                    constructor: o,
                    params: t,
                  });
                },
              };
            });
        }),
        t
      );
    })([{ none: [] }, { multiple: ["elements"] }, { single: ["selection"] }]),
    bo = {
      cata: function (n, e, t, r) {
        return n.fold(e, t, r);
      },
      none: wo.none,
      multiple: wo.multiple,
      single: wo.single,
    },
    yo = function (n, e) {
      return bo.cata(
        e.get(),
        kn.none,
        function (e) {
          return 0 === e.length
            ? kn.none()
            : mo(n, go.firstSelectedSelector(), go.lastSelectedSelector()).bind(
                function (n) {
                  return 1 < e.length
                    ? kn.some({ bounds: m(n), cells: m(e) })
                    : kn.none();
                }
              );
        },
        kn.none
      );
    },
    So = function (n, e) {
      var t = Kr(n, e);
      return 0 < t.length &&
        b(t, function (n) {
          return (
            (K(n, "rowspan") && 1 < parseInt($(n, "rowspan"), 10)) ||
            (K(n, "colspan") && 1 < parseInt($(n, "colspan"), 10))
          );
        })
        ? kn.some(t)
        : kn.none();
    },
    To = Kr,
    xo = function (n, e, t) {
      return {
        element: m(t),
        mergable: m(yo(e, n)),
        unmergable: m(So(t, n)),
        selection: m(To(t, n)),
      };
    },
    Co =
      ((eo = "th,td"),
      function (n) {
        return kn
          .from(n.dom.getParent(n.selection.getStart(), eo))
          .map(Kn.fromDom);
      }),
    Oo = function (n) {
      var e = Zt(n);
      return $t.generate(e).grid();
    },
    No = function (c, u) {
      function e(n) {
        var r, e;
        return {
          type: "selectbox",
          name: "roworcol",
          label: "column" === n ? "Column" : "Row",
          items:
            "column" === n
              ? (function () {
                  var r = s.get().getOrDie("state must be present"),
                    n = r.limit
                      ? r.finishCol() + 1 - r.startCol()
                      : r.columns();
                  return d(n, function (n) {
                    var e = r.limit ? r.startCol() : 0,
                      t = (function (n) {
                        for (var e = n, t = ""; 0 < Math.floor(e); )
                          --e,
                            (t += String.fromCharCode(
                              "A".charCodeAt(0) + (e % 26)
                            )),
                            (e /= 26);
                        return t.split("").reverse().join("");
                      })(n + e + 1);
                    return {
                      text: c.translate(["Column {0}", t]),
                      value: "" + (n + e),
                    };
                  });
                })()
              : ((r = s.get().getOrDie("state must be present")),
                (e = r.limit ? r.finishRow() + 1 - r.startRow() : r.rows()),
                d(e, function (n) {
                  var e = r.limit ? r.startRow() : 0,
                    t = (n + e + 1).toString();
                  return {
                    text: c.translate(["Row {0}", t]),
                    value: "" + (n + e),
                  };
                })),
        };
      }
      function a(n) {
        return {
          title: "Advanced Sort",
          size: "normal",
          body: (function (n) {
            return {
              type: "panel",
              items: [
                {
                  type: "grid",
                  columns: 2,
                  items: [
                    t,
                    e(n),
                    (function (n) {
                      return {
                        type: "selectbox",
                        name: "sort",
                        label: "Sort",
                        items: [
                          "column" === n
                            ? { text: "Column", value: "column" }
                            : { text: "Row", value: "row" },
                          { text: "Selection", value: "selection" },
                          { text: "Table", value: "table" },
                        ],
                      };
                    })(n),
                    r,
                  ],
                },
              ],
            };
          })(n),
          buttons: [
            { type: "cancel", name: "cancel", text: "Cancel" },
            { type: "submit", name: "sort", text: "Sort", primary: !0 },
          ],
        };
      }
      function f() {
        s.set(kn.none());
      }
      var t = {
          type: "selectbox",
          name: "sortby",
          label: "Sort by",
          items: [
            { text: "Column", value: "column" },
            { text: "Row", value: "row" },
          ],
        },
        s = Vn(kn.none()),
        r = {
          type: "selectbox",
          name: "order",
          label: "Order",
          items: [
            { text: "Ascending", value: "ascending" },
            { text: "Descending", value: "descending" },
          ],
        },
        l = function (n, e) {
          if ("sortby" === e.name) {
            var t = n.getData(),
              r = s.get().getOrDie("state must be present"),
              o = {
                roworcol:
                  "column" === t.sortby ? "" + r.startCol() : "" + r.startRow(),
              },
              u = le(le({}, t), o),
              i = le(le({}, a(t.sortby)), {
                onChange: l,
                onClose: f,
                onSubmit: Qr(c),
                initialData: u,
              });
            n.redial(i), n.focus("sortby");
          }
        };
      Co(c).each(function (o) {
        Jr(o, c).each(function (n) {
          function t(n) {
            s.set(kn.some(n));
            var e = {
                sortby: "column",
                roworcol: "" + n.startCol(),
                sort: "column",
                order: "ascending",
              },
              t = le(le({}, a("column")), {
                onChange: l,
                onClose: f,
                onSubmit: Qr(c),
                initialData: e,
              });
            c.windowManager.open(t);
          }
          var e = xo(u, n, o),
            r = Oo(n);
          e.mergable().fold(
            function () {
              Wr(n, o, o).each(function (n) {
                var e = le(le(le({}, n), r), { limit: !1 });
                t(e);
              });
            },
            function (n) {
              var e = le(le(le({}, n.bounds()), r), { limit: !0 });
              t(e);
            }
          );
        });
      });
    },
    Eo = function (u, t, i) {
      function c(n) {
        return { width: Sr(n.dom()), height: Sr(n.dom()) };
      }
      function r(n) {
        return "selection" === n;
      }
      function o(n) {
        return "ascending" === n;
      }
      function a(n) {
        var e = parseInt(n.roworcol, 10);
        !(function (n) {
          return "column" === n;
        })(n.sortby)
          ? (function (n, e) {
              !(function (n) {
                return "row" === n;
              })(n.sort)
                ? r(n.sort)
                  ? o(n.order)
                    ? s(t.sortSelectionColumnsAsc(e))
                    : s(t.sortSelectionColumnsDesc(e))
                  : o(n.order)
                  ? s(t.sortTableColumnsAsc(e))
                  : s(t.sortTableColumnsDesc(e))
                : o(n.order)
                ? s(t.sortRowColumnsAsc(e))
                : s(t.sortRowColumnsDesc(e));
            })(n, e)
          : (function (n, e) {
              !(function (n) {
                return "column" === n;
              })(n.sort)
                ? r(n.sort)
                  ? o(n.order)
                    ? s(t.sortSelectionRowsAsc(e))
                    : s(t.sortSelectionRowsDesc(e))
                  : o(n.order)
                  ? s(t.sortTableRowsAsc(e))
                  : s(t.sortTableRowsDesc(e))
                : o(n.order)
                ? s(t.sortColumnRowsAsc(e))
                : s(t.sortColumnRowsDesc(e));
            })(n, e);
      }
      function n() {
        return Co(u).bind(function (e) {
          return Jr(e, u).bind(function (n) {
            return Wr(n, e, e).map(function (n) {
              return n.startCol();
            });
          });
        });
      }
      function e() {
        return Co(u).bind(function (e) {
          return Jr(e, u).bind(function (n) {
            return Wr(n, e, e).map(function (n) {
              return n.startRow();
            });
          });
        });
      }
      var f = Lr(go, C, C),
        s = function (o) {
          Co(u).each(function (r) {
            Jr(r, u).each(function (e) {
              var n = xo(i, e, r),
                t = c(e);
              o(e, n).each(function (n) {
                !(function (n, e) {
                  var t = c(e);
                  (n.width === t.width && n.height === t.height) ||
                    ((function (n, e, t, r) {
                      n.fire("ObjectResizeStart", {
                        target: e,
                        width: t,
                        height: r,
                      });
                    })(u, e.dom(), n.width, n.height),
                    (function (n, e, t, r) {
                      n.fire("ObjectResized", {
                        target: e,
                        width: t,
                        height: r,
                      });
                    })(u, e.dom(), t.width, t.height));
                })(t, e),
                  u.selection.setRng(n),
                  u.focus(),
                  f.clear(e),
                  xr(e);
              });
            });
          });
        };
      u.addCommand("mceSortTableByColumnAsc", function () {
        n().each(function (n) {
          s(t.sortTableRowsAsc(n));
        });
      }),
        u.addCommand("mceSortTableByColumnDesc", function () {
          n().each(function (n) {
            s(t.sortTableRowsDesc(n));
          });
        }),
        u.addCommand("mceSortTableByRowAsc", function () {
          e().each(function (n) {
            s(t.sortTableColumnsAsc(n));
          });
        }),
        u.addCommand("mceSortTableByRowDesc", function () {
          e().each(function (n) {
            s(t.sortTableColumnsDesc(n));
          });
        }),
        u.addCommand("mceSortTableAdvanced", function (n, e) {
          return a(e);
        }),
        u.addCommand("mceAdvancedTableSort", function () {
          return No(u, i);
        });
    };
  tinymce.PluginManager.add("advtable", no);
})(window);
